clear
version 14.0
set more off


* Specify the year of cash rent data to use in the regression
local reg_year 2013

use "..\dataAnalysis\rent_climate_data", clear

rename stfips stfip
rename cofips cofip
merge 1:1 stfip cofip using "../maps/county_db_my_region2", keep(match using) nogen

* Drop counties in SW New Mexixo and Texas to allow room for the legend
drop if stcofips==35023 | stcofips==35017 | stcofips==35029 | stcofips==35013 | stcofips==48141 | stcofips==35035 ///
		 | stcofips==35051 | stcofips==48229 	


*------------------------------------------------------------------
* Climate Projection RCP 4.5
*------------------------------------------------------------------
summ chg_water_deficit_rcp45AVG, detail
format chg_water_deficit_rcp45AVG %9.1f
spmap chg_water_deficit_rcp45AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(gs14) osize(mthick)) ///
			fcolor(YlOrRd) ndfcolor(white) ndlabel(" ") ///
			clm(custom)  clbreaks(0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0) ///
			legend(position(8) size(3.4))
graph export "../figures/water_deficit_chg_map.png", replace	width(1200)			

summ chg_water_surplus_rcp45AVG, detail
format chg_water_surplus_rcp45AVG %9.2f
spmap chg_water_surplus_rcp45AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(gs14) osize(mthick)) ///
			fcolor("252 141 89" "254 240 217" "240 249 232" "186 228 188" "123 204 196" "43 140 190") ndfcolor(white) ndlabel(" ") ///
			clm(custom)  clbreaks(-0.5 -0.05 0 0.05 0.1 0.25 0.5) ///
			legend(position(8) size(3.4))
graph export "../figures/water_surplus_chg_map.png", replace	width(1200)		

summ chg_gdd_rcp45AVG, detail
format chg_gdd_rcp45AVG %9.2f
spmap chg_gdd_rcp45AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(gs14) osize(mthick)) ///
			fcolor(Oranges) ndfcolor(white) ndlabel(" ") ///
			clm(custom)  clbreaks(1.925 2.5 2.75 3.0 3.25 3.5 3.792) ///
			legend(position(8) size(3.4))
graph export "../figures/gdd_chg_map.png", replace	width(1200)			

summ chg_dday34C_rcp45AVG, detail
format chg_dday34C_rcp45AVG %9.0f
spmap chg_dday34C_rcp45AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(gs14) osize(mthick)) ///
			fcolor(Reds) ndfcolor(white) ndlabel(" ") ///
			clm(custom)  clbreaks(0 2 5 10 20 30 50 74) ///
			legend(position(8) size(3.4))
graph export "../figures/dday34C_chg_map.png", replace	width(1200)	



summ chg_ppt_rcp45AVG, detail
format chg_ppt_rcp45AVG %9.1f
spmap chg_ppt_rcp45AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(gs14) osize(mthick)) ///
			fcolor(RdBu) ndfcolor(white) ndlabel(" ") ///
			clm(custom)  clbreaks(-0.84 -0.5 -0.3 -0.1 0 0.1 0.3 0.5 1.0)  ///
			legend(position(8) size(3.4))
graph export "../figures/ppt_chg_map.png", replace	width(1200)				


summ chg_tmax_rcp45AVG, detail
format chg_tmax_rcp45AVG %9.1f
spmap chg_tmax_rcp45AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(gs14) osize(mthick)) ///
			fcolor(Reds) ndfcolor(white) ndlabel(" ") ///
			clm(eqint)  clnumber(6)  ///
			legend(position(8) size(3.4))


/*
*------------------------------------------------------------------
* Climate Projection RCP 8.5
*------------------------------------------------------------------
summ chg_water_deficit_rcp85AVG, detail
format chg_water_deficit_rcp85AVG %9.1f
spmap chg_water_deficit_rcp85AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(white) osize(mthick)) ///
			fcolor(YlOrRd) ndfcolor(gs11)  ///
			clm(custom)  clbreaks(0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0) ///
			legend(position(8) size(3.4))
graph export "../figures/water_deficit_chg_map.png", replace	width(1200)			

summ chg_water_surplus_rcp85AVG, detail
format chg_water_surplus_rcp85AVG %9.2f
spmap chg_water_surplus_rcp85AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(white) osize(mthick)) ///
			fcolor("252 141 89" "254 240 217" "240 249 232" "186 228 188" "123 204 196" "43 140 190") ndfcolor(gs11)  ///
			clm(custom)  clbreaks(-0.5 -0.05 0 0.05 0.1 0.25 0.5) ///
			legend(position(8) size(3.4))
graph export "../figures/water_surplus_chg_map.png", replace	width(1200)		

summ chg_gdd_rcp85AVG, detail
format chg_gdd_rcp85AVG %9.2f
spmap chg_gdd_rcp85AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(white) osize(mthick)) ///
			fcolor(Oranges) ndfcolor(gs11)  ///
			clm(custom)  clbreaks(1.925 2.5 2.75 3.0 3.25 3.5 3.792) ///
			legend(position(8) size(3.4))
graph export "../figures/gdd_chg_map.png", replace	width(1200)			

summ chg_dday32C_rcp85AVG, detail
format chg_dday32C_rcp85AVG %9.0f
spmap chg_dday32C_rcp85AVG using "../maps/county_coord_my_region2", id(id) ocolor(none ..) ndocolor(none ..) ///
			polygon(data("../maps/state_coord_my_region2") ocolor(white) osize(mthick)) ///
			fcolor(Reds) ndfcolor(gs11)  ///
			clm(custom)  clbreaks(2 10 20 30 40 60 80 107) ///
			legend(position(8) size(3.4))
graph export "../figures/dday32C_chg_map.png", replace	width(1200)	
*/
